#version 450 core

layout(location = 0) in vec3 positionOS;

layout(std140, binding = 0) uniform PerDraw
{
    mat4 viewMatrix;
    mat4 projMatrix;
};

layout(std140, binding = 1) uniform PerObject
{
    mat4 modelMatrix[4];
};

out Varyings
{
    vec4 color;
} o;

const vec4 colors[4] = {
    vec4(1.0, 0.0, 0.0, 1.0),
    vec4(0.0, 1.0, 0.0, 1.0),
    vec4(0.0, 0.0, 1.0, 1.0),
    vec4(1.0, 1.0, 0.0, 1.0)
};

void main()
{
    o.color = colors[gl_InstanceID];
    gl_Position = projMatrix * viewMatrix * modelMatrix[gl_InstanceID] * vec4(positionOS, 1.0);
}
